#ifndef _BINARYTREE_H_
#define _BINARYTREE_H_

#include <stdbool.h>
#define ElementType void*
struct BinaryTreeNode;
typedef struct BinaryTreeNode BTNode;

BTNode *CreateBTNode(ElementType element);
//获取节点的值
ElementType GetNodeData(BTNode *node);

//二叉排序树
struct BinarySortTree;
typedef struct BinarySortTree BSTree;

BSTree *InitBSTree();

void InsertElement(BSTree *tree, ElementType element, int (*funcPtr)(ElementType,ElementType));

//前序遍历
void TravelPrev(BSTree *tree,void (*funcPtr)(ElementType));
//中序遍历
void TravelMid(BSTree *tree,void (*funcPtr)(ElementType));
//后序遍历
void TravelPost(BSTree *tree,void (*funcPtr)(ElementType));

//查找树中的节点
BTNode *FindByElement(BSTree *tree, ElementType element, int (*funcPtr)(ElementType,ElementType));

//删除一个节点
void RemoveByElement(BSTree *tree,ElementType element, int (*funcPtr)(ElementType,ElementType));
//返回树中结点数量
int GetNodeNumber(BSTree *tree);

#endif